package com.zeus.activiti.web.dao;

import com.zeus.activiti.web.entity.Vacation;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

import java.io.Serializable;

/**
 * Created by Administrator on 2015/9/14.
 */
public class VacationDao {
    private SessionFactory sessionFactory;
    private Session getSession(){
        return sessionFactory.getCurrentSession();
    }

    public SessionFactory getSessionFactory() {
        return sessionFactory;
    }

    public void setSessionFactory(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }

    public Serializable save(Vacation vacation){
        return getSession().save(vacation);
    }

    public Vacation get(Serializable id){
        return (Vacation)getSession().get(Vacation.class,id);
    }
}
